<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />

<#include "lib/lib.html" />
<title>添加课程</title>
</head>
<body>
	<form action="${basePath}/courseInfo/edit.do" method="post" class="form form-horizontal" id="form">
	<input hidden="hidden" name="id" value="${obj.id}"/>
	<div class="pop_main" style="padding-left:30px;width: 95%;">
		<div class="panel panel-primary mt-20">
	    	<div class="panel-header">课程信息</div>
	    	<div class="panel-body">
	    		<table class="table table-border table-bordered table-hover table-bg table-sort">
					<tbody>
						<tr>
	    		    		<td style="width:120px;"><strong>课程名称：</strong></td>
	    		    		<td>
	    		    			<input style="width:300px;" class="dd_input input-text size-M" type="text" placeholder="请输入课程名称" id="courseName" name="courseName" value="${obj.courseName}" datatype="*"  nullmsg="请输入课程名称" >
	    		    		</td>
	    		    	</tr>
	    		    	<tr>
	    		    		<td style="width:120px;"><strong>课程图片：</strong></td>
	    		    		<td>
								<input style="width:300px;" readonly="readonly" type="text" class="width200 input-text size-M"  dataType="*" nullmsg="上传课程图片" name="imgUrl" id="imgUrl" value="${obj.imgUrl}"/>
								<input type="file" class="width150 fileInputClass" name="file" id="imgUrlFile" onchange="uploadFile('${basePath}/upload/addFiles.do','imgUrl','File')"/>
	    		    		</td>
	    		    	</tr>
	    		    	<tr>
	    		    		<td style="width:120px;"><strong>轮播图片（多张）：</strong></td>
	    		    		<td>
								<input style="width:300px;" readonly="readonly" type="text" class="width200 input-text size-M"  dataType="*" nullmsg="上传轮播图片" name="imgUrls" id="imgUrls" value="${obj.imgUrls}"/>
								<input type="file" class="width150 fileInputClass" multiple="multiple" name="file" id="imgUrlsFile" onchange="uploadFile('${basePath}/upload/uploadMultipleImg.do','imgUrls','File')"/>
	    		    		</td>
	    		    	</tr>
	    		    	<tr>
	    		    		<td style="width:120px;"><strong>文章图片：</strong></td>
	    		    		<td>
								<input style="width:300px;" readonly="readonly" type="text" class="width200 input-text size-M"  dataType="*" nullmsg="上传文章图片" name="textImg" id="textImg" value="${obj.textImg}"/>
								<input type="file" class="width150 fileInputClass" name="file" id="textImgFile" onchange="uploadFile('${basePath}/upload/addFiles.do','textImg','File')"/>
	    		    		</td>
	    		    	</tr>
	    		    	<tr>
	    		    		<td style="width:120px;"><strong>课类名称：</strong></td>
	    		    		<td>
	    		    			<select style="width:300px;height: 30px;" class="select size-M" id="typeId" name="typeId" size="1">
	    		    				<#if typeList?? && typeList?size gt 0> 
										<#list typeList as dl>
											<option value="${dl.id!}" <#if obj.typeId == dl.id>selected="selected"</#if>>${dl.name!}</option> 
										</#list> 
									</#if>
								</select>
	    		    		</td>
	    		    	</tr>
	    		    	<tr>
	    		    		<td style="width:120px;"><strong>课程单价（元）：</strong></td>
	    		    		<td>
	    		    			<input style="width:300px;" class="dd_input input-text size-M" type="text" placeholder="请输入课程单价" id="amount" name="amount" datatype="*" value="${obj.amount/100}"  nullmsg="请输入课程单价" >
	    		    		</td>
	    		    	</tr>
	    		    	<tr>
	    		    		<td style="width:120px;"><strong>体验价（元）：</strong></td>
	    		    		<td>
	    		    			<input style="width:300px;" class="dd_input input-text size-M" type="text" placeholder="请输入体验价" id="expAmount" name="expAmount" datatype="*" value="${obj.expAmount/100}"  nullmsg="请输入体验价" >
	    		    		</td>
	    		    	</tr>
	    		    	<tr>
	    		    		<td style="width:120px;"><strong>最大上课人数：</strong></td>
	    		    		<td>
	    		    			<input style="width:300px;" class="dd_input input-text size-M" type="text" placeholder="请输入最大上课人数" id="maxCount" name="maxCount" datatype="n" value="${obj.maxCount}" nullmsg="请输入最大上课人数" >
	    		    		</td>
	    		    	</tr>
	    		    	<tr>
	    		    		<td style="width:120px;"><strong>课程时长（分钟）：</strong></td>
	    		    		<td>
	    		    			<input style="width:300px;" class="dd_input input-text size-M" type="text" placeholder="请输入课程时长" id="courseTimeLen" name="courseTimeLen" datatype="n" value="${obj.courseTimeLen}" nullmsg="请输入课程时长" >
	    		    		</td>
	    		    	</tr>
	    		    	<tr>
	    		    		<td style="width:120px;"><strong>消耗课时：</strong></td>
	    		    		<td>
	    		    			<input style="width:300px;" class="dd_input input-text size-M" type="text" placeholder="请输入消耗课时" id="courseUse" name="courseUse" datatype="n" value="${obj.courseUse}" nullmsg="请输入消耗课时" >
	    		    		</td>
	    		    	</tr>
	    		    	<tr>
	    		    		<td style="width:120px;"><strong>排序：</strong></td>
	    		    		<td>
	    		    			<input style="width:300px;" class="dd_input input-text size-M" type="text" placeholder="请输入排序" id="sortNum" name="sortNum" datatype="n"  nullmsg="请输入排序" value="${obj.sortNum}">
	    		    		</td>
	    		    	</tr>
	    		    	<tr>
	    		    		<td style="width:120px;"><strong>简介/备注说明：</strong></td>
	    		    		<td>
	    		    			<textarea style="width:500px;height:200px;" class="input-text size-M" placeholder="简介/备注说明" id="remark" name="remark">${obj.remark}</textarea>
	    		    		</td>
	    		    	</tr>
    		    	</tbody>
			    </table>
	    	</div>
    	</div>
    	
    	<div class="panel panel-danger mt-20">
	    	<div class="panel-header">课程年龄限制(例:1岁3个月-6岁3个月)</div>
	    	<div class="panel-body">
	    		<table class="table table-border table-bordered table-hover table-bg table-sort">
					<tbody>
	    		    	<tr>
	    		    		<td style="width:120px;"><strong>最小年岁：</strong></td>
	    		    		<td>
	    		    			<input style="width:300px;" class="dd_input input-text size-M" type="text"  placeholder="请输入最小年岁" id="minYear" name="minYear" datatype="n" value="${obj.minYear}" nullmsg="请输入最小年岁" >
	    		    		</td>
	    		    	</tr>
	    		    	<tr>
	    		    		<td style="width:120px;"><strong>最小月数：</strong></td>
	    		    		<td>
	    		    			<input style="width:300px;" class="dd_input input-text size-M" type="text"  placeholder="请输入最小月数" id="minMonth" name="minMonth" datatype="n" value="${obj.minMonth}" nullmsg="请输入最小月数" >
	    		    		</td>
	    		    	</tr>
	    		    	<tr>
	    		    		<td style="width:120px;"><strong>最大年岁：</strong></td>
	    		    		<td>
	    		    			<input style="width:300px;" class="dd_input input-text size-M" type="text"  placeholder="请输入最大年岁" id="maxYear" name="maxYear" datatype="n" value="${obj.maxYear}" nullmsg="请输入最大年岁" >
	    		    		</td>
	    		    	</tr>
	    		    	<tr>
	    		    		<td style="width:120px;"><strong>最小月数：</strong></td>
	    		    		<td>
	    		    			<input style="width:300px;" class="dd_input input-text size-M" type="text"  placeholder="请输入最大月数" id="maxMonth" name="maxMonth" datatype="n" value="${obj.maxMonth}" nullmsg="请输入最大月数" >
	    		    		</td>
	    		    	</tr>
	    		    	
    		    	</tbody>
			    </table>
	    	</div>
    	</div>
		<div class="submit_btn">
			<button style="width:100px;height:40px;" type="button" name="" value="提    交" onclick="submitButt()" class="btn btn-warning radius"><i class="Hui-iconfont">&#xe676;</i> 提    交</button>
		</div>
	</div>
	</form>
<script type="text/javascript">
		$(function(){
			$("#form").Validform({
				tiptype:3,
				showAllError:true,   //表单提交时显示所有提示信息
				ignoreHidden: true,  //隐藏的表单元素不校验
				ajaxPost:true,
				callback:function(data){
					$.Hidemsg();
					if(data.resultCode==200){
						layer.msg('保存成功!', {
							icon : 1,
							time : 1000
						});
						//parent.location.replace("${basePath}/payv2PayWayRate/payv2PayWayRateListAll.do?payWayId="+$("#payViewType").val());
						setTimeout(function () { 
					        layer_close();
					    }, 1000);
					}else{
						$("#form").resetForm();
						layer.msg('保存失败，请你检查数据!', {
							icon : 1,
							time : 1000
						});
					}
				}
			});
		});
		
		function uploadFile(url,idstr,filestr) {
			if($("input[id='"+idstr+filestr+"']").val()==""){
  	            layer.msg('请选择上传文件！', function(){});
				return;
			}
			commonUp(url, $("input[id='"+idstr+filestr+"']"), function(data) {
					$("#"+idstr).val(data.Data.url);
			});
	
		}
	
		//无刷新上传文件
		function commonUp(url, e, callback) {
			$.ajaxFileUpload({
				url : url,
				secureuri : false,
				fileElement : e,
				dataType : "JSON",//返回数据的类型
				success : function(data,status) {
					if (data.resultCode == 200) {
						if (callback) {
							callback(data);
						}
					} else {
						//alert("上传失败！");
						alert(data.Data);
					}
					
				}
			});
		}
		
		$(document).ready(function(){
			$('select').searchableSelect();
		});

		function submitButt(){
			$("#form").attr(
					"action",
					"${basePath}/courseInfo/edit.do").submit(); 
		}

		//验证输入的数字合法性
		function ValidateFloat(e, pnumber){ 
			if (!/^\d+[.]?\d*$/.test(pnumber)){ 
				$(e).val(/^\d+[.]?\d*/.exec($(e).val())); 
			}
			return false; 
		}
</script>
</body>
</html>